import React from 'react';
import { Typography } from 'antd';
import Title from './title';
import Source from './source';
import { NewsItemProps } from '../../index';
import ImgLoader from './imgLoader';

const { Paragraph } = Typography;

const SummaryItem: React.FC<NewsItemProps> = (props) => {
  const { ImgUrl, Summary, showImage, ID, detail, newsKey, ...others } = props;
  const prefixCls = 'inbiz-News-summary';
  return (
    <div className={prefixCls}>
      {showImage && (
        <div className={`${prefixCls}_img_wrapper`}>
          <ImgLoader className={`${prefixCls}-img`} src={ImgUrl} key={ImgUrl} />
        </div>
      )}
      <div className={`${prefixCls}-content`}>
        <div>
          <Title {...props} tagType="resume" />
        </div>
        <div className={`${prefixCls}-content-zaiyao`}>
          <Paragraph ellipsis={{ rows: 3 }}>
            <div dangerouslySetInnerHTML={{ __html: Summary }}></div>
          </Paragraph>
        </div>
        <div>
          <Source type={2} {...others} />
        </div>
      </div>
    </div>
  );
};

export default SummaryItem;
